<?php
/**
 * Created by PhpStorm.
 * User: kongqi
 * Date: 2019/10/4
 * Time: 13:16
 */

namespace App\Plugin\HostServer\Models;


class PnHostSvCard extends HostServerBase
{
    public static function getStatus($field=''){
        $type=[
            1=>'已使用',
            0=>'未使用',

        ];
        return $field==''?$type:$type[$field];
    }
    /**
     * 取得会员
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function user()
    {
        return $this->belongsTo(PnHostSvUser::class, 'user_id', 'id');
    }

    /**
     * 取得type 名字
     * @return array|mixed
     */
    public function getStatusNameAttributes()
    {
        return static::getStatus($this->status);
    }
}